var currentIndexTemp = 0;
var date = "";
var indexTemp = 0;
var nf,frame,date,fdStatus;
var fdMineSum,fdMineSumDSum,fdMineSumMSum,fdMineSumYSum;//产量
var fdMoveLength,fdMoveLengthDSum,fdMoveLengthMSum,fdMoveLengthYSum;//进尺
var fdPgValue,fdPgValueDSum;//排矸量
var fdGanziValue,fdGanziValueDSum;//矸子
var fdClValue,fdClValueDSum;//材料
var fdWorknumId;//班次
efform_onload = function ()
{
	date = date2String();
	$("#inqu_status-0-fdReport").val(date);
	
}; 

function date2String(){
    var datetime = new Date();
    var year = datetime.getFullYear();
    var month = datetime.getMonth() + 1 < 10 ? "0" + (datetime.getMonth() + 1) : datetime.getMonth() + 1;
    var date = datetime.getDate() < 10 ? "0" + datetime.getDate() : datetime.getDate();
//    var hour = datetime.getHours()< 10 ? "0" + datetime.getHours() : datetime.getHours();
//    var minute = datetime.getMinutes()< 10 ? "0" + datetime.getMinutes() : datetime.getMinutes();
//    var second = datetime.getSeconds()< 10 ? "0" + datetime.getSeconds() : datetime.getSeconds();
//    return year + "-" + month + "-" + date+" "+hour+":"+minute+":"+second;
    return year + "-" + month + "-" + date;
}

button_query_onclick = function () 
{   
	$("#ef_grid_result-fdMinesumDay").val("");
	$("#ef_grid_result-fdMinesumMiddle").val("");
	$("#ef_grid_result-fdMinesumNight").val("");
	$("#ef_grid_result-fdMinesumDsum").val("");
	$("#ef_grid_result-fdMovelengthDay").val("");
	$("#ef_grid_result-fdMovelengthMiddle").val("");
	$("#ef_grid_result-fdMovelengthNight").val("");
	$("#ef_grid_result-fdMovelengthDsum").val("");
	$("#ef_grid_result-fdPgvalueDay").val("");
	$("#ef_grid_result-fdPgvalueMiddle").val("");
	$("#ef_grid_result-fdPgvalueNight").val("");
	$("#ef_grid_result-fdPgvalueDsum").val("");
	$("#ef_grid_result-fdGanzivalueDay").val("");
	$("#ef_grid_result-fdGanzivalueMiddle").val("");
	$("#ef_grid_result-fdGanzivalueNight").val("");
	$("#ef_grid_result-fdGanzivalueDsum").val("");
	$("#ef_grid_result-fdClvalueDay").val("");
	$("#ef_grid_result-fdClvalueMiddle").val("");
	$("#ef_grid_result-fdClvalueNight").val("");
	$("#ef_grid_result-fdClvalueDsum").val("");
	frame = 0;
	date = 	$("#inqu_status-0-fdReport").val();
	if(date == ""){
		date = date2String();
		$("#inqu_status-0-fdReport").val(date);		
	}
		
	var info = getDetail("ef_region_inqu","inqu_status");
	if (null != info){ 
		if(indexTemp=='0')
		{
			fundiv(0,0);
		
		}
		if(indexTemp=='1')
		{
			fundiv(1,1);
		
		}
		if(indexTemp=='2')
		{
			fundiv(2,2);
		
		}
		if(indexTemp=='3')
		{
			fundiv(3,3);
	
		}
		if(indexTemp=='4')
		{
			fundiv(4,4);
	
		}
		if(indexTemp=='5')
		{
			fundiv(5,5);
	
		}
		if(indexTemp=='6')
		{
			fundiv(6,6);
	
		}
		if(indexTemp=='7')
		{
			fundiv(7,7);
		}
		info.set("fdVirtualDate",date);
		EiCommunicator.send("ZMCG80", "query", info, query_callback);
    } 
}

var query_callback={
		onSuccess:function(eiInfo){
			if(eiInfo.getStatus()==-1){
				EFAlert("操作失败，原因："+eiInfo.getMsg());
			}else{
				var eiBlock = eiInfo.getBlock("result");
				var meta=eiBlock.getBlockMeta();
				var obj = eiBlock.getRows();
				$("#ef_grid_result-fdMinesumDay").val(obj[0][2]);
				$("#ef_grid_result-fdMinesumMiddle").val(obj[0][3]);
				$("#ef_grid_result-fdMinesumNight").val(obj[0][4]);
				$("#ef_grid_result-fdMinesumDsum").val(obj[0][5]);
				$("#ef_grid_result-fdMinesumMsum").val(obj[0][6]);
				$("#ef_grid_result-fdMinesumYsum").val(obj[0][7]);
				$("#ef_grid_result-fdMovelengthDay").val(obj[0][8]);
				$("#ef_grid_result-fdMovelengthMiddle").val(obj[0][9]);
				$("#ef_grid_result-fdMovelengthNight").val(obj[0][10]);
				$("#ef_grid_result-fdMovelengthDsum").val(obj[0][11]);
				$("#ef_grid_result-fdMovelengthMsum").val(obj[0][12]);
				$("#ef_grid_result-fdMovelengthYsum").val(obj[0][13]);
				$("#ef_grid_result-fdPgvalueDay").val(obj[0][14]);
				$("#ef_grid_result-fdPgvalueMiddle").val(obj[0][15]);
				$("#ef_grid_result-fdPgvalueNight").val(obj[0][16]);
				$("#ef_grid_result-fdPgvalueDsum").val(obj[0][17]);
				$("#ef_grid_result-fdGanzivalueDay").val(obj[0][18]);
				$("#ef_grid_result-fdGanzivalueMiddle").val(obj[0][19]);
				$("#ef_grid_result-fdGanzivalueNight").val(obj[0][20]);
				$("#ef_grid_result-fdGanzivalueDsum").val(obj[0][21]);
				$("#ef_grid_result-fdClvalueDay").val(obj[0][22]);
				$("#ef_grid_result-fdClvalueMiddle").val(obj[0][23]);
				$("#ef_grid_result-fdClvalueNight").val(obj[0][24]);
				$("#ef_grid_result-fdClvalueDsum").val(obj[0][25]);
			}
		},
		onFail:function(eMsg)
		{
			EFAlert("操作失败，原因："+eMsg); 
		}
}




function fundiv(currentIndex,index){ 
	currentIndexTemp = currentIndex;
	indexTemp = index;
//	date = 	$("#inqu_status-0-fdReport").val();
	if(index ==0){  
	    frame = frames[0];
		frame.src = "DispatchAction.do?efFormEname=ZMCG82&flag=1&querydate="+date;
		efform.setStatus(0, "正在加载...");
	}else if(index ==1){ 
		 frame = frames[1]; 
		frame.src = "DispatchAction.do?efFormEname=ZMCG51&flag=2";
		efform.setStatus(0, "正在加载...");
	}else if(index ==2){ 
		 frame = frames[2];
		 if (date != '' && date != undefined) {//+"&inqu_status-0-fdCurrentDate=" + date
			 frame.src = "DispatchAction.do?efFormEname=ZMCG83&flag=3&inqu_status-0-fdVirtualDate=" + date ;
		 } else {
			 frame.src = "DispatchAction.do?efFormEname=ZMCG83&flag=3";
		 }
		efform.setStatus(0, "正在加载...");
	}else if(index ==3){ 
		 frame = frames[3];
		 if (date != '' && date != undefined) {
			 frame.src = "DispatchAction.do?efFormEname=ZMCG84&flag=4&inqu_status-0-fdVirtualDate=" + date;
		 } else {
			 frame.src = "DispatchAction.do?efFormEname=ZMCG84&flag=4";
		 }
		efform.setStatus(0, "正在加载...");
	}else if(index ==4){ 
		 frame = frames[4];
		 frame.src = "DispatchAction.do?efFormEname=ZMCG85";
		 efform.setStatus(0, "正在加载...");
	}else if(index ==5){ 
		 frame = frames[5];
		 if (date != '' && date != undefined) {
			 frame.src = "DispatchAction.do?efFormEname=ZMCG86" +"&flag=5" +"&inqu_status-0-fdVirtualDate=" + date;
		 } else {
			 frame.src = "DispatchAction.do?efFormEname=ZMCG86" +"&flag=5";
		 }
		efform.setStatus(0, "正在加载...");
	}else if(index ==6){
		 frame = frames[6];
		frame.src = "DispatchAction.do?efFormEname=ZMCG72" +"&nf="+nf+"&flag=6";
		efform.setStatus(0, "正在加载...");
	}else if(index ==7){ 
		 frame = frames[7];
		frame.src = "DispatchAction.do?efFormEname=ZMCG71" +"&nf="+nf+"&flag=7";
		efform.setStatus(0, "正在加载...");
	} 
} 
